import io.renren.wechat.common.aes.WXBizCorpCrypt;
import org.junit.Test;

/**
 * @author dmcp@qq.com
 * @since 2021/11/21 19:54
 */
public class MsgTools {
    String corpId = "ww4f8a11931c91b281";
    String suiteId = "wwa11becac8855d919";
    String corpToken = "OSR9w6EpFF8B3InvQtVP5hjtN2Cw";
    final String corpEncodingAesKey = "VRWzJwMV8K1Ag70OTavWMcUkTGABFnvVpARBkXdBHgv";

    String suiteToken = "0GjzZvAeHjm12Dv3a4KhR3h";
    final String suiteEncodingAesKey = "YYgVbAOKdPM8UTfM8C7dk7X2vZvEQzazZhRd1KC1s5K";


    @Test
    public void data() throws Exception {
        String msgSignature = "c3c398349e5624c6f05376dd095af135c09b4c69";
        String timeStamp = "1637494602";
        String nonce = "1637581889";
        String postData = "<xml><ToUserName><![CDATA[wwa11becac8855d919]]></ToUserName><Encrypt><![CDATA[qJBLE9Q2ps5z+M6qOVXlsLnB2dv2Gdm/b0xyHMetpqhQW9naiL3g8jNmAzWr2pHZ4J9PW5RQnOisDw6oQDDY6/i8Pt00mHh1IN197aaZCmzWpO9xyuLunktq1lUvvN+CrswRiaGHCTbN7n6fyQKLrrJsCpwcvTmGywv1yECYuO3zV2o1q190r3AM7UPPRYL4+MJsK+vjHBU00B6HO4CGokhUWEZwR1TD+LAWLN/Nj6Ue7tyj8luVJ+kNdmIksyOO3inpxIv5fcHBiN8L9UE2oqkPBt/BIMJnyMcwIM0g9AZtanbE8q+mNiqnUWC9jFV6MDgzRgnW0x8jUr7zLJbiI0aLEhmhQHzocf1Pa6+1770OwA9SltfoAbP9wJGo/Gy5UgQROyzZfbAdNA+hXz/b+Q7ktSzCXfJoQh8ZrnpcYHE=]]></Encrypt><AgentID><![CDATA[]]></AgentID></xml>";
        //WXBizCorpCrypt wxBizMsgCrypt = new WXBizCorpCrypt(suiteToken, suiteEncodingAesKey, suiteId);
        WXBizCorpCrypt wxBizMsgCrypt = new WXBizCorpCrypt(suiteToken, suiteEncodingAesKey, "wwa11becac8855d919");
        //WXBizCorpCrypt wxBizMsgCrypt = new WXBizCorpCrypt(suiteToken, suiteEncodingAesKey, corpId);
        //WXBizCorpCrypt wxBizMsgCrypt = new WXBizCorpCrypt(corpToken, corpEncodingAesKey, corpId);

        final String decrypt = wxBizMsgCrypt.DecryptMsg(msgSignature, timeStamp, nonce, postData);
        System.out.println(decrypt);
    }
}
